<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Close the current Shockwave Flash file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.swf-addcolor.html">swf_addcolor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.swf-definebitmap.html">swf_definebitmap</a></div>
 <div class="up"><a href="ref.swf.html">SWF 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.swf-closefile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">swf_closefile</h1>
  <p class="verinfo">(PHP 4)</p><p class="refpurpose"><span class="refname">swf_closefile</span> &mdash; <span class="dc-title">Close the current Shockwave Flash file</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.swf-closefile-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>swf_closefile</strong></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$return_file</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Close a file that was opened by the
   <span class="function"><a href="function.swf-openfile.html" class="function">swf_openfile()</a></span> function.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.swf-closefile-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">return_file</code></em></dt>

     <dd>

      <p class="para">
       If set then the contents of the SWF file are returned from the
       function.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.swf-closefile-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.swf-closefile-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3482">
    <p><strong>Example #1 
     Creating a simple flash file based on user input and outputting it
     and saving it in a database
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;The&nbsp;$text&nbsp;variable&nbsp;is&nbsp;submitted&nbsp;by&nbsp;the<br />//&nbsp;user<br /><br />//&nbsp;Global&nbsp;variables&nbsp;for&nbsp;database<br />//&nbsp;access&nbsp;(used&nbsp;in&nbsp;the&nbsp;swf_savedata()&nbsp;function)<br /></span><span style="color: #0000BB">$DBHOST&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$DBUSER&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"sterling"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$DBPASS&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"secret"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">swf_openfile</span><span style="color: #007700">(</span><span style="color: #DD0000">"php://stdout"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">256</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">256</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">30</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_definefont</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Ligon-Bold"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_fontsize</span><span style="color: #007700">(</span><span style="color: #0000BB">12</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_fontslant</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_definetext</span><span style="color: #007700">(</span><span style="color: #0000BB">11</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$text</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_pushmatrix</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_translate</span><span style="color: #007700">(-</span><span style="color: #0000BB">50</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_placeobject</span><span style="color: #007700">(</span><span style="color: #0000BB">11</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">60</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_popmatrix</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_showframe</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_startdoaction</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_actionstop</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">swf_enddoaction</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">swf_closefile</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">?<br />&nbsp;&nbsp;</span><span style="color: #0000BB">swf_savedata</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">)&nbsp;:<br />&nbsp;&nbsp;die(</span><span style="color: #DD0000">"Error&nbsp;could&nbsp;not&nbsp;save&nbsp;SWF&nbsp;file"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;void&nbsp;swf_savedata(string&nbsp;data)<br />//&nbsp;Save&nbsp;the&nbsp;generated&nbsp;file&nbsp;a&nbsp;database<br />//&nbsp;for&nbsp;later&nbsp;retrieval<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">swf_savedata</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">$DBHOST</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$DBUSER</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$DBPASS</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$dbh&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">mysql_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$DBHOST</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$DBUSER</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$DBPASS</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die&nbsp;(</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Error&nbsp;[%d]:&nbsp;%s"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mysql_errno</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">mysql_error</span><span style="color: #007700">()));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"INSERT&nbsp;INTO&nbsp;swf_files&nbsp;(file)&nbsp;VALUES&nbsp;('</span><span style="color: #0000BB">$data</span><span style="color: #DD0000">')"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$sth&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$sth</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die&nbsp;(</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Error&nbsp;[%d]:&nbsp;%s"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mysql_errno</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">mysql_error</span><span style="color: #007700">()));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mysql_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$sth</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">mysql_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.swf-closefile-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.swf-openfile.html" class="function" rel="rdfs-seeAlso">swf_openfile()</a> - Open a new Shockwave Flash file</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.swf-addcolor.html">swf_addcolor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.swf-definebitmap.html">swf_definebitmap</a></div>
 <div class="up"><a href="ref.swf.html">SWF 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
